import { axios } from '@/utils/request'

const api = {
  // 患者回访配置
  revisitPage: '/revisit/config/page',
  revisitCreate: '/revisit/config/create',
  revisitDelete: '/revisit/config/delete',
  revisitUpdate: '/revisit/config/update',
  getUreportAll: '/system/ureport/all',
  ureportCreate: '/system/ureport/create',
  ureportUpdate: '/system/ureport/update',
  ureportDelete: '/system/ureport/delete',
  getDeptAndPositionList: '/login/getDeptAndPositionList',
  getDeptId: '/revisit/config/getDeptId',
  // cms
  createCms: '/cms/category/create',
  deleteCms: '/cms/category/delete',
  getCms: '/cms/category/getCmsCategory',
  getCmsList: '/cms/category/all',
  updateCms: '/cms/category/update',
  pageCms: '/cms/category/page',
  createArticle: '/cms/article/saveCmsArticle',
  deleteArticle: '/cms/article/delete',
  getCmsArticle: '/cms/article/getCmsArticle',
  updateArticle: '/cms/article/update',
  // 修改密码
  changePass: '/user/updatePassword'

}
export function changePass(data) {
  return axios({
    url: api.changePass,
    method: 'put',
    data
  })
}

export function createArticle(data) {
  return axios({
    url: api.createArticle,
    method: 'post',
    data
  })
}

export function updateArticle(data) {
  return axios({
    url: api.updateArticle,
    method: 'put',
    data
  })
}

// getCmsList
export function getCmsList(params) {
  return axios({
    url: api.getCmsList,
    method: 'get',
    params
  })
}

export function getCmsArticle(params) {
  return axios({
    url: api.getCmsArticle,
    method: 'get',
    params
  })
}

export function deleteArticle(id, data = {}) {
  return axios({
    url: `${api.deleteArticle}/${id}`,
    method: 'delete',
    data
  })
}

export function pageCms(params) {
  return axios({
    url: api.pageCms,
    method: 'get',
    params
  })
}

export function updateCms(data) {
  return axios({
    url: api.updateCms,
    method: 'put',
    data
  })
}

export function getCms(params) {
  return axios({
    url: api.getCms,
    method: 'get',
    params
  })
}

export function deleteCms(id, data = {}) {
  return axios({
    url: `${api.deleteCms}/${id}`,
    method: 'delete',
    data
  })
}

export function createCms(data) {
  return axios({
    url: api.createCms,
    method: 'post',
    data
  })
}

export function getDeptId(id, params = {}) {
  return axios({
    url: `${api.getDeptId}/${id}`,
    method: 'get',
    params
  })
}

// getDeptAndPositionList
export function getDeptAndPositionList(params) {
  return axios({
    url: api.getDeptAndPositionList,
    method: 'get',
    params
  })
}

export function ureportDelete(id, data = {}) {
  return axios({
    url: `${api.ureportDelete}/${id}`,
    method: 'delete',
    data
  })
}

export function ureportUpdate(data) {
  return axios({
    url: api.ureportUpdate,
    method: 'put',
    data
  })
}

export function ureportCreate(data) {
  return axios({
    url: api.ureportCreate,
    method: 'post',
    data
  })
}

export function getUreportAll(params) {
  return axios({
    url: api.getUreportAll,
    method: 'get',
    params
  })
}

export function revisitPage(params) {
  return axios({
    url: api.revisitPage,
    method: 'get',
    params
  })
}

export function revisitCreate(data) {
  return axios({
    url: api.revisitCreate,
    method: 'post',
    data
  })
}

export function revisitUpdate(data) {
  return axios({
    url: api.revisitUpdate,
    method: 'put',
    data
  })
}

export function revisitDelete(id, data) {
  return axios({
    url: `${api.revisitDelete}/${id}`,
    method: 'delete',
    data
  })
}


export function authorityList(parameter) {
  return axios({
    url: '/system/authority/list',
    method: 'post',
    data: parameter
  })
}

export function authorityAdd(parameter) {
  return axios({
    url: '/system/authority/add',
    method: 'post',
    data: parameter
  })
}

export function authorityUpdate(parameter) {
  return axios({
    url: '/system/authority/update',
    method: 'post',
    data: parameter
  })
}

export function authorityDelete(parameter) {
  return axios({
    url: '/system/authority/delete',
    method: 'post',
    data: parameter
  })
}

export function roleList(parameter) {
  return axios({
    url: '/system/role/list',
    method: 'post',
    data: parameter
  })
}

export function roleAdd(parameter) {
  return axios({
    url: '/system/role/add',
    method: 'post',
    data: parameter
  })
}

export function roleUpdate(parameter) {
  return axios({
    url: '/system/role/update',
    method: 'post',
    data: parameter
  })
}

export function roleDelete(parameter) {
  return axios({
    url: '/system/role/delete',
    method: 'post',
    data: parameter
  })
}

export function functionList() {
  return axios({
    url: '/system/function/list',
    method: 'post'
  })
}

export function getSystemLog(params) {
  return axios({
    url: '/system/log/page',
    method: 'get',
    params
  })
}

export function getLoginLog(params) {
  return axios({
    url: '/system/loginLog/page',
    method: 'get',
    params
  })
}